import { defineStore } from "pinia";
import type { User, Customer } from "@/service/api/types/user";

const useUserStore = defineStore("user", {
    state: () => ({
        userInfo: {},
        isAuthenticated: false,
    }),
    getters: {
        getUserInfo: (state) => state.userInfo,
        getIsAuthenticated: (state) => state.isAuthenticated,
    },
    actions: {
        setUserInfo(userInfo: User | Customer) {
            this.userInfo = userInfo;
        },
        setIsAuthenticated(isAuthenticated: boolean) {
            this.isAuthenticated = isAuthenticated;
        },
    },
});

export default useUserStore;
